package com.gopay.common.cps.dao.wallet.activity.impl;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.wallet.activity.WaActivityCountDetailDao;
import com.gopay.common.domain.dps.WaActivityCountDetail;
import com.gopay.common.order.dao.CommonQueryDAO;

/**
 * @author ZHOUPENG
 * @date   2017年8月17日 下午12:01:32
 */
@Repository("waActivityCountDetailDao")
public class WaActivityCountDetailDaoImpl extends BaseDAOImpl<WaActivityCountDetail, Serializable> implements WaActivityCountDetailDao {

	@Resource(name = "commonQueryDAO")
	private CommonQueryDAO commonQueryDAO;
	
	@Override
	public List<Object[]> getWinningUserNum(String activityId) {
		StringBuffer sb = new StringBuffer();
		sb.append(" select count(a.activity_id) custNum,1")
		.append("  from wa_activity_count_detail a")
		.append("  where a.activity_id =:activityId ")
		.append("  and a.receive_detail_amt > 0 and a.receive_detail_amt != 9999");
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("activityId",activityId);
		List<Object[]> activityList= commonQueryDAO.findBySql(sb.toString(), map);
		return activityList.size()==0?null:activityList;
	}
	
}
